package cn.cloudreal.cbms.resmonitor.service.impl;

import java.util.List;
import java.util.Map;
import cn.cloudreal.cbms.common.util.PageBean;
import cn.cloudreal.cbms.resmonitor.dao.ResMonitorDao;
import cn.cloudreal.cbms.resmonitor.service.ResMonitorService;
import cn.cloudreal.cbms.vo.FundBudget;
import cn.cloudreal.cbms.vo.Mediasumm;
import cn.cloudreal.cbms.vo.PutInPlanMonth;
import cn.cloudreal.cbms.vo.ResourceMonitor;
import cn.cloudreal.cbms.vo.SourcePlanYear;

/**
 * <p>
 * Title: ITC
 * </p>
 * <p>
 * Description:资源监控service层实现类
 * </p>
 * <p>
 * Copyright: Copyright (c) 2010
 * </p>
 * <p>
 * Company:云恒瑞通
 * </p>
 * 
 * @author 夏加冬
 * @date 2012-7-9
 */
public class ResMonitorServiceImpl implements ResMonitorService
{

    /** 查询数据dao */
    private ResMonitorDao resMonitorDao;

    /**
     * 根据合同年份查询对应的媒体
     */
    public List<Mediasumm> getMediaSummariesByYear(int year,
            String mediaName,
            String city)
    {
        return resMonitorDao.getMediaSummariesByYear(year, mediaName, city);
    }

    /**
     * 添加预算（年）
     */
    public int saveSourcePlanYear(SourcePlanYear sourcePlanYear){
        return resMonitorDao.saveSourcePlanYear(sourcePlanYear);
    }
    
    /**
     * 添加预算(月)
     */
    public void savePutInPlanMonth(PutInPlanMonth putInPlanMonth){
        resMonitorDao.savePutInPlanMonth(putInPlanMonth);
    }
    
    /**
     * 资源监控媒体计划投放量录入
     * 
     * @param page
     * @return null
     */
    public Integer addResMonitorRelatoin(List<PutInPlanMonth> putInPlanMonths,
            SourcePlanYear sourcePlanYear,int m )
    {
       return  resMonitorDao.addResMonitorRelatoin(putInPlanMonths, sourcePlanYear,m);
    }
    /**
     * 资源监控媒体计划投放量更新
     * 
     * @param page
     * @return null
     */
    public void updateResMonitorRelatoin(List<PutInPlanMonth> putInPlanMonths,SourcePlanYear sourcePlanYear)
    {
        resMonitorDao.updateResMonitorRelatoin(putInPlanMonths, sourcePlanYear);
    }

    /**
     * 根据年份和地市查找对应的媒体
     * 
     * @return list
     */
    @SuppressWarnings("unchecked")
    public List<ResourceMonitor> getMediaSummaries(PageBean page, Map map)
    {
        return resMonitorDao.getMediaSummaries(page, map);
    }
    /**
     * 查找年度资源投放计划
     * @return SourcePlanYear
     */
    public SourcePlanYear getSourcePlanYear(Integer sourceId)
    {
        return resMonitorDao.getSourcePlanYear(sourceId);
    }
    /**
     * 获取分阶段投放计划
     * @return list
     */
    public List<PutInPlanMonth> getPutInPlanMonths(String idPrice,String costType,String costSubType)
    {
        return resMonitorDao.getPutInPlanMonths( idPrice, costType, costSubType);
    }
    /**
     * 获取年度投放计划
     * @return list
     */
    public SourcePlanYear getSourceIsExist(String id_price,String costType,String costSubType)
    {
        return resMonitorDao.getSourceIsExist( id_price, costType, costSubType);
    }
    /**
     * 获取费用预算
     * @return list
     */
    public FundBudget getFundBudgetIsExist(String year,String city,String costType,String costSubType)
    {
        return resMonitorDao.getFundBudgetIsExist( year,city,costType, costSubType);
    }
    
    /**
     * 查找预算（月）是否存在
     */
    public List<PutInPlanMonth> findPutMonthByNowTotalPutInAndType(PutInPlanMonth putInPlanMonth){
        return resMonitorDao.findPutMonthByNowTotalPutInAndType(putInPlanMonth);
    }
    
    public ResMonitorDao getResMonitorDao()
    {
        return resMonitorDao;
    }

    public void setResMonitorDao(ResMonitorDao resMonitorDao)
    {
        this.resMonitorDao = resMonitorDao;
    }

    public void addResMonitorRelatoin_01(List<PutInPlanMonth> putInPlanMonths, SourcePlanYear sourcePlanYear, int m) {
        resMonitorDao.addResMonitorRelatoin_01(putInPlanMonths, sourcePlanYear, m);
    }

    

}
